<template>
	<view class="mainPage" :style="{'padding-bottom': `${$store.state.safeArea.bottom || 0}px`}">
		<view class="head" style="background-image: url(https://swl-1304532176.cos.ap-guangzhou.myqcloud.com/chongesheng_doctor/img/bgimg.png);background-size: cover;">
			<view class="box">
				<image class="touxiang" :src="info.user_avatar" mode="aspectFill" ></image>
			</view>
			<view class="box1">
				<view class="title">
					<text class="name">{{info.user_name}}</text>
					<text >{{info.professional}}</text>
					</view>
				<view  class="doc">
					<text class="">{{info.col_name}}</text>
					<text class="yiyuan">{{info.hos_name}}</text>
				</view>
			</view>
			<view class="box2">
				<view class="title">
					已认证
				</view>
				<!-- 设置图标 -->
				<!-- <view class="img" @click="">
					<image src="https://swl-1304532176.cos.ap-guangzhou.myqcloud.com/chongesheng_doctor/img/set.png" ></image>
				</view> -->
			</view>
		</view>
		<view class="body">
			<view class="balance">
			<view class="content">
				<text>{{info.money}}</text>
				<text>我的余额</text>
			</view>
			<view class="content">
				<text>{{info.total_money}}</text>
				<text>总收入</text>
			</view>
			<view class="content">
				<view class="but" @tap="towithdrawal">提现</view>
			</view>
			
			</view>
			<view class="service">
				<view class="cate-section">
					<view class="cate-item" @tap="toprofit">
						<image src="https://swl-1304532176.cos.ap-guangzhou.myqcloud.com/chongesheng_doctor/icon/profit.png"></image>
						<text>我的收益</text>
					</view>
					<view class="cate-item" @click="toauthentication">
						<image src="https://swl-1304532176.cos.ap-guangzhou.myqcloud.com/chongesheng_doctor/icon/authentication.png" ></image>
						<text>我的认证</text>
					</view>
					<view class="cate-item" @click="toservice">
						<image src="https://swl-1304532176.cos.ap-guangzhou.myqcloud.com/chongesheng_doctor/icon/service.png"></image>
						<text>我的服务</text>
					</view>
					
					<view class="cate-item" @click="toprescribeshare">
						<image src="https://swl-1304532176.cos.ap-guangzhou.myqcloud.com/chongesheng_doctor/icon/prescribe.png"></image>
						<text>开具处方</text>
					</view>

					<view class="cate-item" @click="toarchives">
						<image src="https://swl-1304532176.cos.ap-guangzhou.myqcloud.com/chongesheng_doctor/icon/archives.png"></image>
						<text>档案修改</text>
					</view>
					
					<view class="cate-item" @click="toset">
						<image src="https://swl-1304532176.cos.ap-guangzhou.myqcloud.com/chongesheng_doctor/icon/shezhi.png"></image>
						<text>设置</text>
					</view>
					
					<!-- <view class="cate-item">
						<button open-type="contact" type="default" style="border:none !important;outline:none !important; width: 88rpx;height: 88rpx;background: url(https://swl-1304532176.cos.ap-guangzhou.myqcloud.com/chongesheng_doctor/icon/kefu.png) no-repeat ;background-size: 100% 100%;font-size: 28rpx;margin-left: 0;margin-right: 0;padding-left: 0;padding-right: calc(100% - 260rpx);color: #333333;margin-top: 14rpx;" show-message-card session-from send-message-path send-message-title></button>
						<button open-type="contact" type="default" style="border:none !important;outline:none !important; background-color:transparent !important;font-size: 28rpx;margin-left: 0;margin-right: 0;padding-left: 0;padding-right: calc(100% - 260rpx);color: #333333;margin: 0;" show-message-card session-from send-message-path send-message-title>联系客服</button>
					</view> -->
					
				</view>
			
			</view>

		</view>

	</view>
</template>

<script>
	var that 
	var audio
	export default {
		data() {
			return {
				info: {}
			}
		},
		onLoad() {
			that=this
			audio = uni.createInnerAudioContext()
			audio.src = 'https://swl-1304532176.cos.ap-guangzhou.myqcloud.com/chongesheng/ding.mp3'
			// 判断是否有缓存
			let userInfo = uni.getStorageSync("chongdoc_login")
			if (userInfo == '' || userInfo == undefined) {
			} else {
				console.log('已登录')
				that.doctorInfo()
				// 个人中心开启监听
				var onMessageReceiveds
				onMessageReceiveds = function(event) {
					if(that.$store.state.doc_type == 3){
						console.log('医生端个人中心监听' ,event);
						uni.showTabBarRedDot({
							index:0
						})
						audio.play()
					}
				};
				that.$tim.on(that.$TIM.EVENT.MESSAGE_RECEIVED, onMessageReceiveds);
			}
		},
		onShow() {
			that.$store.state.doc_type = 3
		},
		onShow() {
			that.doctorInfo()
		},
		methods: {
			toprescribeshare() {
				uni.navigateTo({
					url:"../../pagesC/mine/prescribe/SharetoUser"
				})
			},
			toarchives(){
				uni.navigateTo({
					url:"../../pagesC/mine/archives/archives"
				})
			},
			toprofit(){
				uni.navigateTo({
					url:"../../pagesC/mine/profit/profit"
				})
			},
			toservice(){
				uni.navigateTo({
					url:"../../pagesC/mine/service/service"
				})	
			},
			towithdrawal(){
				uni.navigateTo({
					url:"../../pagesC/mine/service/withdrawal"
				})	
			},
			toauthentication(){
				uni.navigateTo({
					url:"../../pagesC/mine/authentication/authentication"
				})
			},
			toset(){
				uni.navigateTo({
					url:'../../pagesC/mine/setup/setup'
				})
			},
			doctorInfo(){
				that.$postAjax1('Doctor_doctorInfo', {}, function(data) {
					that.info=data.data.data
					that.$store.state.user_Info = that.info
					console.log('获取用户信息成功',that.info)
				})
			}
		}
	}
</script>

<style scoped lang="scss">

.head{
	position: relative;
	width:100%;
	height: 404rpx;
	background-color: #FE7600;
	padding: 160rpx 0 50rpx  50rpx;
	image{
		// position: absolute;
		// top: 80rpx;
		// left: 50rpx;
		// display: inline-block; 
		width: 120rpx;
		height: 120rpx;
		// box-shadow: 0px 4rpx 8rpx 0rpx #FE7F0F;
		// border-radius: 50px;
	}
	.box{
		width: 20%; 
		display: inline-block;
		.touxiang{
			border-radius: 50%;
		}
	}
	.box1{
		width: 65%; 
		display: inline-block; 
		color: #FFFFFF; 
		position: relative;
		top: -30rpx;
		.title{
			margin: 15rpx;
			.name{
				font-size: 32rpx; 
				margin-right: 20rpx;
			}
		}
		.doc{
			margin-left: 15rpx;
			text{
				vertical-align: middle;
			}
			.yiyuan{
				margin-left: 20rpx;
				display: inline-block;
				width: 300rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}
		}
	}
	.box2{
		width: 15%; 
		display: inline-block; 
		text-align: right;
		.title{
			background: #000000;
			border-radius: 200px 0px 0px 200px;
			opacity: 0.65;
			padding: 2px 5px;
			color: #ffffff; position: absolute; top: 170rpx;
		}
		.img{
			position: absolute; 
			top: 220rpx; 
			right: 10rpx;
			image{
				width: 55rpx; height: 55rpx;
			}
		}
	}
}
.body{
	margin: 0 40rpx;
	.balance{
		width: 100%;
		height: 132rpx;
		background: #FFFFFF;
		box-shadow: 0px 4rpx 8rpx 0px #ECE4E4;
		border-radius: 12rpx;
		position: relative;
		top: -50rpx;
		display: none;
	}
	.content{
		display: inline-block;
		width: 33%;
		text-align: center;
		line-height: 66rpx;
		text{
			display: block;
		}
		.but{
			width: 122rpx;
			height: 46rpx;
			background: linear-gradient(223deg, #FF9331 0%, #FE7600 100%);
			border-radius: 4rpx;
			line-height: 46rpx;
			color: #FFFFFF;
			margin: 0 auto;
			position: relative;
					top: -30rpx;
		}
	}
}
.service{
	height: 374rpx;
	background: #FFFFFF;
	box-shadow: 0px 4rpx 8rpx 0px #ECE4E4;
	border-radius: 12rpx;
	// margin-top: -30rpx;
	position: relative;
	top: -50rpx;
	/* 分类 */
	.cate-section {
		display: flex;
		justify-content: end;
		align-items: center;
		flex-wrap:wrap;
		padding: 30rpx 22rpx; 
		background: #fff;
		border-radius: 12rpx;
		.cate-item {
			display: flex;
			flex-direction: column;
			align-items: center;
			width: 33%;
								margin-bottom: 30rpx;
		}
		
		image {
			width: 88rpx;
			height: 88rpx;
			margin-bottom: 14rpx;
			border-radius: 50%;
			//opacity: .7;
			//box-shadow: 4rpx 4rpx 20rpx rgba(250, 67, 106, 0.3);
		}
	}
}
</style>
